import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

import '@/assets/global.css'

import zhCn from "element-plus/es/locale/lang/zh-cn";

// 配置axios - 使用相对路径，通过Vite代理转发
axios.defaults.baseURL = '/api'
axios.defaults.timeout = 10000

// 请求拦截器
axios.interceptors.request.use(
  config => {
    // 可以在这里添加token等认证信息
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截器
axios.interceptors.response.use(
  response => {
    return response
  },
  error => {
    console.error('API请求错误:', error)
    return Promise.reject(error)
  }
)

const app = createApp(App)

app.use(router)
app.use(ElementPlus,{
    locale:zhCn
})

app.mount('#app')
